
-- $Id: TitleFrame.lua 71 2009-04-06 04:43:41Z Fylgjas $

-- ========================================================================= --
-- Copyright © 2009 Thomas ROBERT (aka Fylgjas EU - Marécage de Zangar)      --
-- ========================================================================= --
-- This file is part of FyLooter.                                            --
--                                                                           --
-- FyLooter is free software: you can redistribute it and/or modify it under --
-- the terms of the GNU General Public License as published by the Free      --
-- Software Foundation, either version 3 of the License, or (at your option) --
-- any later version.                                                        --
--                                                                           --
-- FyLooter is distributed in the hope that it will be useful, but WITHOUT   --
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     --
-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for  --
-- more details.                                                             --
--                                                                           --
-- You should have received a copy of the GNU General Public License along   --
-- with FyLooter. If not, see <http://www.gnu.org/licenses/>.                --
-- ========================================================================= --

local revision = tonumber(string.sub("$Rev: 71 $", 7, -3));

if (FyLooter.revision < revision) then
  FyLooter.revision = revision;
end

-- ========================================================================= --

-- 
-- _start_moving
--
local function _start_moving(self, button)
  if (button == "LeftButton") then
    self:GetParent():StartMoving();
  end
end

-- 
-- _stop_moving
--
local function _stop_moving(self, button)
  if (button == "LeftButton") then
    self:GetParent():StopMovingOrSizing();
  end
end

-- ========================================================================= --

-- 
-- FyLooter:CreateTitleFrame()
--
function FyLooter:CreateTitleFrame(parent)
  -- TitleFrame
  TitleFrame = CreateFrame("Frame", nil, parent);
  TitleFrame:Hide();
  TitleFrame:SetHeight(30);
  TitleFrame:SetBackdrop(FyLooter.db.settings.backdrop);
  TitleFrame:EnableMouse(true);
  TitleFrame:SetScript("OnMouseDown", _start_moving);
  TitleFrame:SetScript("OnMouseUp", _stop_moving);

  local f = TitleFrame:CreateFontString(nil, "ARTWORK", "GameFontNormal");
  f:SetHeight(16);
  f:SetPoint("CENTER");

  -- 
  -- TitleFrame:SetTitle()
  --
  function TitleFrame:SetTitle(title)
    f:SetText(title);
  end

  return TitleFrame;
end

-- ========================================================================= --

